package com.cntcdt.api.db.dao;

import java.util.List;

import com.cntcdt.api.db.dao.base.ReturnCdbOperateDaoBase;
import com.cntcdt.api.db.model.ReturnCdbOperateModel;

/**
 * 这是return_cdb_operate的Dao实现类
 */
public class ReturnCdbOperateDao extends ReturnCdbOperateDaoBase   {
    /**
     * ReturnCdbOperateDao对象
     */
    private static ReturnCdbOperateDao instance = new ReturnCdbOperateDao();

    /**
     * 默认构造方法
     */
    private ReturnCdbOperateDao() {
    }

    /**
     * 获得对象实例
     */
    public static ReturnCdbOperateDao getInstance() { 
         return instance;
    } 

    public ReturnCdbOperateModel findByCDB(String cdb) {
        String sql = "SELECT * FROM " + TABLE + " WHERE cdb = ? order by id desc";
       Object[] paramObjs = {cdb};
       List<ReturnCdbOperateModel > modelList = this.queryModelList(sql, paramObjs);
       if(modelList != null && modelList.size() > 0){ 
             return  modelList.get(0);
       } 
       return null;
   }
    
    public ReturnCdbOperateModel findByCheckHistoryId(int checkHisotryId) {
        String sql = "SELECT * FROM " + TABLE + " WHERE checkHistoryId = ?";
       Object[] paramObjs = {checkHisotryId};
       List<ReturnCdbOperateModel > modelList = this.queryModelList(sql, paramObjs);
       if(modelList != null && modelList.size() > 0){ 
             return  modelList.get(0);
       } 
       return null;
   }
}
